<!-- 图片 配字 -->
<template>
	<view class="main" >
		<u-toast ref="uToast" /><!-- 不能写最下边 -->
		<view 
		@click="to(i.to)"
		class="hc-one"
		v-for="i in datas" :style="'width:'+size+'%'">
				<u-image
					width="100"
					height="100"
					:src="i.url">
				</u-image>
			<text>
				{{i.title}}
			</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"imageText",
		data() {
			return {
			};
		},
		props:['size','datas'],
		methods:{
			to(e){
				if(!this.$store.getters.token)
					this.$refs.uToast.show({
						title: '未登录，请先登录',
						type: 'error',
						position: 'top'
					})
				else if(e)
					uni.navigateTo({
						url:e
					})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main{
		margin-top: 20rpx;
		display: flex;
		flex-flow: row wrap;
		justify-content: space-around;
		view{
			// width: 50%;
			display: flex;
			// justify-content: center;
			align-items: center;
			flex-flow: column nowrap;
			i{
				
			}
			text{
				margin-top: 10rpx;
				font-family: '黑体';
			}
		}
	}
</style>
